package com.my.code.map;

import java.util.HashSet;

public class TestAnd {
    public static void main(String[] args) {
        int len = 1 << 4;
        int len2 = 1 << 5;
        System.out.println("len = " + len);

        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < 1000; i++) {
            System.out.println("n = " + i + ", binary = " + Integer.toBinaryString(i));

            System.out.println("len & n = " + (len & i));
            //System.out.println("len2 & n = " + (len2 & n));
            System.out.println("len-1 & n = " + (len-1 & i));
            System.out.println("len2-1 & n = " + (len2-1 & i));
            System.out.println();
            set.add(len & i);
        }

        System.out.println("set = " + set);
    }
}
